#! /bin/sh

hostOsType="$(uname -s)"

threadCount=1

case "${hostOsType}" in
	FreeBSD)
		threadCount="$(/sbin/sysctl -n hw.ncpu)"
	;;
	Linux|CYGWIN*)
		threadCount="$(nproc)"
	;;
	SunOS)
		threadCount="$(kstat -m cpu_info|grep -w core_id|uniq|wc -l)"
	;;
	Darwin)
		threadCount="$(/usr/sbin/sysctl -n hw.ncpu)"
	;;
	*)
	;;
esac

echo "${threadCount}"

exit 0
